#pragma once
#include <windows.h>
#include <tchar.h>
#include <string>
#include "iDumpMaxData.h"

#define MAX_GAMESKIN_REGPATH _T("SOFTWARE\\Autodesk\\3dsmax\\ISKINPLUGIN")


class iRegstryAssist
{
public:
	iRegstryAssist(void);
	~iRegstryAssist(void);

public:
	static void SaveSkinOptionRegistry( iDumpMaxData* pData );
	static void LoadSkinOptionRegistry( iDumpMaxData* pData );
	static bool SetSkinRegistry( char* pRegName, int nType, LPBYTE datas, size_t size );
	template<typename dataType>
	static bool GetSkinRegistry( dataType& data, char* pRegName, DWORD size )
	{
		HKEY KeyData;
		LONG lResult = 0;	
		DWORD nType = REG_DWORD;

		lResult  = RegOpenKeyEx( HKEY_LOCAL_MACHINE, MAX_GAMESKIN_REGPATH, 0, KEY_ALL_ACCESS, &KeyData );
		if( lResult != ERROR_SUCCESS )
			return false;

		lResult = RegQueryValueEx( KeyData, pRegName, NULL, NULL, (LPBYTE)&data, &size );	
		if( lResult != ERROR_SUCCESS )
			return false;

		return true;
	}
};
